<div class="actions index" style="margin: 0px;">
<h2><?php __('Access Control Objects');?></h2>

<?php e($form->create('Action', array('action'=>'index'))); ?>
<fieldset>
<table id="actions" class="table fixed" style="width: 40%;">
<thead>
    <tr>
        <th width="2%"><?php __('Controller');?></th>
        <th width="49%"><?php __('Action');?></th>
        <th width="49%"><?php __('Admin');?></th>
    </tr>
</thead>
<?php foreach($actions as $i=>$current_action_group):
    $all_actions = $current_action_group['actions'];
    $controller = $current_action_group['name'];
    ?>
        <!-- Controller name -->
        <tr class="toggler" name="<?php e(low($controller)); ?>">
            <td colspan="3" class="bold"><?php e($controller); ?></td>
        </tr>
        <!-- Controller actions list-->
        <?php foreach($all_actions as $current_action): ?>
        <tr class="<?php e(low($controller)); ?>">
            <td>&nbsp;</td>
            <!-- Action name -->
            <td><?php e($current_action['action']); ?></td>
            <!-- Add or Delete -->
            <td>
            <?php if(isset($acos[$current_action['model']])): ?>
                <?php e($form->input('Actions.SecurityAccess.'.$current_action['model_alias'],
                    array('label'=>sprintf('<span class="exclude">%s</span>', __('Exclude', true)),'type'=>'checkbox','value'=>'delete')
                )); ?>
            <?php else: ?>
                <?php e($form->input('Actions.SecurityAccess.'.$current_action['model_alias'],
                    array('label'=>sprintf('<span class="include">%s</span>', __('Include', true)),'type'=>'checkbox','value'=>'include')
                )); ?>
            <?php endif; ?>
            </td>
        </tr>
        <?php endforeach; ?>
<?php endforeach; ?>
</table>
<?php e($form->submit(__('Save Changes', true), array('class'=>'submit attention'))); ?>
</fieldset>
<?php e($form->end()); ?>

</div>
<?php //debug($actions); debug($acos); ?>
<script type="text/javascript">
jQuery(function(){
    $('tr.toggler').click(function(){
        $(this).nextAll('tr.'+$(this).attr('name')).toggle();
    }).click();
});
</script>